//
// Created by leiyan on 2017/6/29.
//

#include <iostream>
using namespace std;

//常量宏
#define PI 3.14159

//函数宏
#define MIN(a,b) (a<b ? a : b)

//条件编译
#define DEBUG

//# 和 ## 预处理运算符在 C++ 和 ANSI/ISO C 中都是可用的。# 运算符会把 replacement-text 令牌转换为用引号引起来的字符串。
#define MKSTR( x ) #x
#define concat(a, b) a ## b
int testDefine ()
{

    cout << "Value of PI :" << PI << endl;


    int i, j;
    i = 100;
    j = 30;
    cout <<"较小的值为：" << MIN(i, j) << endl;


#ifdef DEBUG
    cerr <<"Trace: Inside main function" << endl;
#endif

#if 0
    /* 这是注释部分 */
   cout << MKSTR(HELLO C++) << endl;
#endif

#ifdef DEBUG
    cerr <<"Trace: Coming out of main function" << endl;
#endif

    cout << MKSTR(HELLO C++) << endl;

    int xy = 100;
    cout << concat(x, y)<<"\n"<<endl;


    cout << "Value of __LINE__ : " << __LINE__ << endl;
    cout << "Value of __FILE__ : " << __FILE__ << endl;
    cout << "Value of __DATE__ : " << __DATE__ << endl;
    cout << "Value of __TIME__ : " << __TIME__ << endl;

    /*
        Value of __LINE__ : 51
        Value of __FILE__ : /Users/leiyan/CLionProjects/basis/预处理器.cpp
        Value of __DATE__ : Jun 29 2017
        Value of __TIME__ : 10:45:52
     */
    return 0;
}